package org.or5e.plugin.core.vo;

import java.util.LinkedList;
import java.util.List;

import javax.xml.bind.JAXBElement;

import org.or5e.plugin.pojo.itunes.Array;
import org.or5e.plugin.pojo.itunes.Dict;

public class ITunesPlaylist {
	public String playListName = null;
	public String playlistID = null;
	public String playlistPersistanceID = null;
	public String playListVisible = null;
	public List<String> trackIDList = new LinkedList<String>();
	public String getPlayListName() {
		return playListName;
	}
	public void setPlayListName(String playListName) {
		this.playListName = playListName;
	}
	public String getPlaylistID() {
		return playlistID;
	}
	public void setPlaylistID(String playlistID) {
		this.playlistID = playlistID;
	}
	public String getPlaylistPersistanceID() {
		return playlistPersistanceID;
	}
	public void setPlaylistPersistanceID(String playlistPersistanceID) {
		this.playlistPersistanceID = playlistPersistanceID;
	}
	public String getPlayListVisible() {
		return playListVisible;
	}
	public void setPlayListVisible(String playListVisible) {
		this.playListVisible = playListVisible;
	}
	public List<String> getTrackIDList() {
		return trackIDList;
	}
	public void setTrackIDList(List<String> trackIDList) {
		this.trackIDList = trackIDList;
	}
	public void addToTrackIDList(String trackIDList) {
		this.trackIDList.add(trackIDList);
	}
	@SuppressWarnings("rawtypes")
	public void addToTrackIDList(Array trackList) {
		List<Dict> playlistTrackList = trackList.getDict();
		for (Dict dict : playlistTrackList) {
			String trackID = String.valueOf(((JAXBElement)dict.getDictOrArrayOrData().get(1)).getValue());
			addToTrackIDList(trackID);
		}
	}

	@Override public String toString() {
		return "["+this.playlistID+":"+this.playListName+"]";
	}
}
